using System;
using System.Collections.Generic;

public class SignalService
{
    private static readonly SignalService _instance = new SignalService();
    public static SignalService Instance => _instance;
    
    private readonly Dictionary<string, Action<bool>> _signalHandlers = new Dictionary<string, Action<bool>>();

    public void RegisterSignalHandler(string signalName, Action<bool> handler)
    {
        _signalHandlers[signalName] = handler;
    }

    public void UpdateSignal(string signalName, bool value)
    {
        if (_signalHandlers.TryGetValue(signalName, out var handler))
        {
            handler(value);
        }
    }

    public void UpdateExternalSignal(string signalName, bool value)
    {
        UpdateSignal(signalName, value);
    }
}